<template>
    <!-- <div class="box"> -->
    <div id="CesiumContainer">
        <!-- 全景视频 -->
        <!-- <source src="" type="application/x-mpegURL" /> -->
        <video id="trailer1" muted playsinline style="display: none"></video>
        <!-- <video id="trailer1" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
        </video> -->
        <video id="trailer2" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer4" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer5" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer6" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer7" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer8" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer9" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer10" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
        <video id="trailer11" autoplay muted playsinline controls style="display: none" class="video-js vjs-default-skin">
            <!-- <source src="" type="application/x-mpegURL" /> -->
        </video>
    </div>
    <!-- </div> -->
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
import * as Cesium from "cesium";
import "../../../public/jquery-3.5.1.min.js"
import Viewer from "cesium/Source/Widgets/Viewer/Viewer";
import http from "axios"
import hlsjs from "hls.js";
import kang from "../../common/mitt";
import { ElMessage } from 'element-plus'
import flvjs from 'flv.js'

// const props = defineProps(["cruiseData"]);
// console.log(props);

//球
let viewer = ref()
//创建地球和模型
let createMap = () => {
    // 加载地球
    viewer.value = new Cesium.Viewer("CesiumContainer", {
        animation: false, // 动画小组件
        baseLayerPicker: false, // 底图组件，选择三维数字地球的底图（imagery and terrain）。
        fullscreenButton: false, // 全屏组件
        vrButton: false, // VR模式
        geocoder: false, // 地理编码（搜索）组件
        homeButton: false, // 首页，点击之后将视图跳转到默认视角
        infoBox: false, // 信息框
        sceneModePicker: false, // 场景模式，切换2D、3D 和 Columbus View (CV) 模式。
        selectionIndicator: false, // 是否显示选取指示器组件
        timeline: false, // 时间轴
        scene3DOnly: false, //如果设置为true，则所有几何图形以3D模式绘制以节约GPU资源
        navigationHelpButton: false, // 帮助提示，如何操作数字地球。
        // 如果最初应该看到导航说明，则为true；如果直到用户明确单击该按钮，则该提示不显示，否则为false。
        navigationInstructionsInitiallyVisible: false,
        imageryProvider: new Cesium.ArcGisMapServerImageryProvider({
            url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer',
            maximumLevel: 16,
        }),
        // imageryProvider: new Cesium.WebMapTileServiceImageryProvider({
        //     url: 'http://localhost:8080/geoserver/gwc/service/wmts?layer=cesium:1&style={style}&tilematrixset=EPSG:4326&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&TileMatrix={TileMatrixSet}:{TileMatrix}&TileCol={TileCol}&TileRow={TileRow}',
        //     layer: 'police:1',
        //     style: '',
        //     format: 'image/png',
        //     tileMatrixSetID: 'EPSG:4326',
        //     maximumLevel: 21,
        //     tilingScheme: wgs84
        // }),
        // terrainProvider: new Cesium.CesiumTerrainProvider({
        //     url: 'http:localhost:8888/terrain/nx'
        // }),
        msaaSamples: 8
    });
    //优化项--关闭相关特效
    viewer.value.scene.debugShowFramesPerSecond = true;//显示fps
    // viewer.value.scene.moon.show = false;//月亮
    // viewer.value.scene.fog.enabled = false;//雾
    // viewer.value.scene.sun.show = false;//太阳
    // viewer.value.scene.skyBox.show = false;//天空盒
    // viewer.value.resolutionScale = 1.0;//画面细度，默认值为1.0
    //去除版权信息
    viewer.value._cesiumWidget._creditContainer.style.display = "none";
    //开启地形深度检测
    viewer.value.scene.globe.depthTestAgainstTerrain = false;
          //右键旋转
          viewer.value.scene.screenSpaceCameraController.zoomEventTypes = [Cesium.CameraEventType.WHEEL, Cesium.CameraEventType.PINCH];
          
          viewer.value.scene.screenSpaceCameraController.tiltEventTypes = [Cesium.CameraEventType.PINCH, Cesium.CameraEventType.RIGHT_DRAG ];
    //初始位置北京  116.435314, 40.960521, 10000000.0
    // viewer.camera.flyTo({
    //     destination: Cesium.Cartesian3.fromDegrees(116.391931, 39.907206, 4000.0),
    //     orientation: {
    //         heading: Cesium.Math.toRadians(-10.0),
    //         pitch: Cesium.Math.toRadians(-90.0),
    //         //roll : 0.0
    //     }
    // });
    // 天空盒---------------------------------------------------------------------------------------------
    var scene = viewer.value.scene;
    scene.skyBox = new Cesium.SkyBox({
        sources: {
            positiveX: "./src/assets/img/skybox_px.jpg",
            negativeX: "./src/assets/img/skybox_mx.jpg",
            positiveY: "./src/assets/img/skybox_py.jpg",
            negativeY: "./src/assets/img/skybox_my.jpg",
            positiveZ: "./src/assets/img/skybox_pz.jpg",
            negativeZ: "./src/assets/img/skybox_mz.jpg",
        },
    });
    //禁止双击事件
    viewer.value.cesiumWidget.screenSpaceEventHandler.removeInputAction(
        Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
    );
    // 云层2---------------------------------------------------------------------------------------------
    viewer.value.entities.add({
        id: "云层",
        rectangle: {
            coordinates: Cesium.Rectangle.fromDegrees(-180, -90, 180, 90),
            height: 100000,
            outline: false,
            // outlinewidth:'99.0',//windows系统下不能设置固定为1
            material: new Cesium.ImageMaterialProperty({
                image: "./src/assets/img/skyboxclouds.png",
                transparent: true, //别忘了把允许透明打开
                color: Cesium.Color.WHITE.withAlpha(0.7),
            }),
        },
    });
    // DirectionalLight 表示 从无限远的地方向单一方向发射的光。
    viewer.value.scene.light = new Cesium.DirectionalLight({
        direction: new Cesium.Cartesian3(0.354925, -0.890918, -0.283358),
    });
    viewer.value.camera.frustum.fov = 1.12;
    // ---------------------------------------------------------------------------------------------
    // 宛陵湖
    viewer.value.scene.camera.flyTo({
        destination: Cesium.Cartesian3.fromDegrees(118.7482969, 30.9254499, 2607),
        orientation: {
            heading: Cesium.Math.toRadians(358.70), // 水平偏角，默认正北 0
            pitch: Cesium.Math.toRadians(-88.81), // 俯视角，默认-90，垂直向下
            roll: 0, // 旋转角
        },
    });

    //控制模型的位置
    // palaceTileset.readyPromise.then(function (palaceTileset) {
    //     viewer.value.scene.primitives.add(palaceTileset);
    //     var heightOffset = -40; //可以改变3Dtiles的高度
    //     var boundingSphere = palaceTileset.boundingSphere;
    //     var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
    //     var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
    //     var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
    //     var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
    //     palaceTileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
    //     viewer.value.zoomTo(palaceTileset, new Cesium.HeadingPitchRange(0.5, -0.2, palaceTileset.boundingSphere.radius *
    //         1.0));
    // })
    // var Pitch = -0.520755507237188;
    //     var Heading = 2.98386713252185;
    //     var x = -2633939.91026626;
    //     var y = 4800914.61286567;
    //     var z = 3259377.4506127;
    // //标点1
    // var entity = viewer.value.entities.add({
    //     name: '123',
    //     position: Cesium.Cartesian3.fromDegrees(118.749768975769, 30.9311996161833, 5),

    //     //lon:115.9440582263599lat:36.41967427128944
    //     label: { //文字标签
    //         url: "2123",
    //         text: "北停车场",
    //         font: '500 30px Helvetica',// 15pt monospace
    //         scale: 0.5,
    //         // style: LabelStyle.FILL,
    //         //   fillColor: Color.WHITE,
    //         //   pixelOffset: new Cartesian2(110, -70),   //偏移量
    //         showBackground: true,
    //         // backgroundColor: new Color(26 / 255, 196 / 255, 228 / 255, 1.0)
    //     },
    //     billboard: { //图标
    //         image: "../../public/spred.png",
    //         width: 80,
    //         height: 80,
    //         // pixelOffset: new Cartesian2(100, -35),   //偏移量
    //         //  heightReference:HeightReference.CLAMP_TO_GROUND,
    //         //   VerticalOrigin:VerticalOrigin.BOTTOM
    //     },

    // });
    // var handler = new Cesium.ScreenSpaceEventHandler(viewer.value.scene.canvas);
    // handler.setInputAction(function (click) {
    // var pick = viewer.value.scene.pick(click.position);
    // console.log(pick.id+"pick")
    // if (pick.id._name != undefined && pick != undefined && pick.id != undefined && pick != undefined) {
    // console.log(pick.id,'988989')
    // var text = document.getElementById("text")
    // text.style.display = "block";
    // var trailer1 = document.getElementById("trailer1")
    // rtcVideo(trailer1, pick.id._name)
    // } else {

    // }

    // }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    // 点击事件
    // var handlClick = new Cesium.ScreenSpaceEventHandler(viewer.value.scene.canvas);
    // handlClick.setInputAction((e: any) => {
    //     const pickObject = viewer.value.scene.pick(e.position);
    //     console.log(pickObject);

    // if (pickObject && pickObject.id.name === "滨湖大道桥") {
    //     console.log("点击找位置", pickObject.id.name)
    //     if (["滨湖大道桥"].includes(pickObject.id.name)) {
    //         CloseCfg1()
    //         ondemandLogin().then((res: any) => {
    //             dialogTableVisiblecfg1.value = true
    //             // console.log(responses.data.data.hls);
    //             let flvCfg1 = res.data.data.hls;//获取到接口中视频流地址m3u8
    //             let videoFlvCfg1 = document.getElementById("videoFlvCfg1");//获取到video标签（id）
    //             var hls = new hlsjs();
    //             hls.loadSource(flvCfg1);//视频流交给hls
    //             hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
    //             //播放视频
    //             hls.on(hls.Events, function () {
    //                 videoFlvCfg1.play();
    //             })
    //         });
    //     }
    // }
    // palaceTileset/pickObject
    // }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
    // viewer.value.screenSpaceEventHandler.setInputAction(function (click) {
    // var pickedEntity = viewer.value.scene.pick(click.position);
    // if (Cesium.defined(pickedEntity) && pickedEntity.id === entity) {
    //     console.log(1);

    //     // 获取点击的位置（Cartographic对象）
    //     // var position = Cesium.Ellipsoid.WGS84.cartesianToCartographic(entity.position.getValue(Cesium.JulianDate.now()));
    //     // var lon = Cesium.Math.toDegrees(position.longitude);
    //     // var lat = Cesium.Math.toDegrees(position.latitude);

    //     // 创建自定义信息框的HTML内容
    //     // var content = '<div style="padding: 10px;">';
    //     // content += '<h2>' + entity.properties.name + '</h2>';
    //     // content += '<p>经度: ' + lon + '</p>';
    //     // content += '<p>纬度: ' + lat + '</p>';
    //     // content += '<p>' + entity.properties.description + '</p>';
    //     // content += '</div>';

    //     // 弹出自定义信息框
    //     // var popup = window.open("", "_blank", "width=400,height=300");
    //     // popup.document.write(content);
    // }
    // }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    // var handler = new Cesium.ScreenSpaceEventHandler(viewer.value.scene.canvas);
    // handler.setInputAction(function (click) {
    // 	var pick = viewer.value.scene.pick(click.position);
    // 	 console.log(pick.id+"pick")


    // 	if (pick.id._name != undefined && pick != undefined && pick.id != undefined && pick != undefined) {
    // 		console.log(pick.id._name)


    // 	} else {

    // 	}

    // }, Cesium.ScreenSpaceEventType.LEFT_CLICK);

    // let handler = new Cesium.ScreenSpaceEventHandler(viewer.value.scene.canvas);
    // handler.setInputAction(function (click) {
    //     let pickedObject = viewer.value.scene.pick(click.position);
    //     if (Cesium.defined(pickedObject)) {
    //         // 点击了实体
    //         console.log('点击了实体:', entity);
    //     }
    // }, Cesium.ScreenSpaceEventType.LEFT_CLICK);


}
// 数据
// let points = [
//     {
//         x: -2180888.4610119504,
//         y: 4387328.281215225,
//         z: 4070086.2903183666,
//         heading: 0.022731006352433525,
//         pitch: -0.972841495448542,
//         duration: 6
//     },
//     {
//         x: -2180912.9018427837,
//         y: 4387301.9796640985,
//         z: 4070092.6085081045,
//         heading: 6.282996181021591,
//         pitch: -1.020300727828678,
//         duration: 6
//     },
//     {
//         x: -2181017.5013388293,
//         y: 4387269.808242594,
//         z: 4070157.793241215,
//         heading: 6.273926302098958,
//         pitch: -1.334821857295125,
//         duration: 10
//     },
//     {
//         x: -2181068.7560794097,
//         y: 4387243.435456547,
//         z: 4070173.5178403254,
//         heading: 0.013044035555349609,
//         pitch: -1.4407032209013422,
//         duration: 10
//     },
//     {
//         x: -2181032.9893011358,
//         y: 4387222.792673762,
//         z: 4070081.969190965,
//         heading: 1.050034328623445,
//         pitch: -0.6345797728893219,
//         duration: 10
//     },
//     {
//         x: -2181101.6290741162,
//         y: 4387120.8592427205,
//         z: 4070085.14958719,
//         heading: 1.2248671389165304,
//         pitch: -0.43126270189510185,
//         duration: 11
//     },
//     {
//         x: -2181182.0949511044,
//         y: 4387076.713720111,
//         z: 4070089.6122127455,
//         heading: 1.2248671384392535,
//         pitch: -0.4312627015212609,
//         duration: 14
//     },
//     {
//         x: -2181584.3489090004,
//         y: 4386999.56026525,
//         z: 4070217.5494081196,
//         heading: 0.010624721840157392,
//         pitch: -1.5654866670357768,
//         duration: 8
//     },
//     {
//         x: -2181663.4141617324,
//         y: 4386960.260341496,
//         z: 4070217.5290977266,
//         heading: 0.010624721840157392,
//         pitch: -1.5654866670408158,
//         duration: 10
//     },
//     {
//         x: -2181784.416927479,
//         y: 4386882.962212063,
//         z: 4070217.9348923187,
//         heading: 0.010624721840175155,
//         pitch: -1.5654866667427707,
//         duration: 10
//     },
//     {
//         x: -2181834.1470972174,
//         y: 4386882.401966701,
//         z: 4070217.2929187655,
//         heading: 0.005659766124603394,
//         pitch: -1.5128517127729357,
//         duration: 8
//     },
//     {
//         x: -2181853.80412751,
//         y: 4386675.447666,
//         z: 4070145.9673791323,
//         heading: 2.08359007370124,
//         pitch: -0.40255138393064227,
//         duration: 8
//     },
//     {
//         x: -2181909.9799466915,
//         y: 4386656.579538563,
//         z: 4070136.2062756093,
//         heading: 1.9158803295164573,
//         pitch: -0.40108043538811855,
//         duration: 10
//     },
//     {
//         x: -2181729.8843451748,
//         y: 4386771.583081157,
//         z: 4070224.2370416513,
//         heading: 2.0663773109378596,
//         pitch: -0.4168819243001569,
//         duration: 10
//     },
//     {
//         x: -2182029.007085912,
//         y: 4386625.911796723,
//         z: 4070220.8874167777,
//         heading: 2.066377311260174,
//         pitch: -0.4168819239066912,
//         duration: 8
//     },
//     {
//         x: -2182133.5762324147,
//         y: 4386563.402788625,
//         z: 4070165.5728514385,
//         heading: 1.9979333397842556,
//         pitch: -0.5570781264376654,
//         duration: 11
//     },
//     {
//         x: -2182170.6208315506,
//         y: 4386531.214649578,
//         z: 4070131.6228256933,
//         heading: 1.7269154470783068,
//         pitch: -0.2518900672015305,
//         duration: 8
//     },
//     //   中最后一个
//     {
//         x: -2182235.50064298,
//         y: 4386505.069374657,
//         z: 4070125.069104558,
//         heading: 1.6891010835354745,
//         pitch: -0.25235012557051606,
//         duration: 10
//     },

//     {
//         x: -2182170.6208315506,
//         y: 4386531.214649578,
//         z: 4070131.6228256933,
//         heading: 1.7269154470783068,
//         pitch: -0.2518900672015305,
//         duration: 8
//     },
//     {
//         x: -2182133.5762324147,
//         y: 4386563.402788625,
//         z: 4070165.5728514385,
//         heading: 1.9979333397842556,
//         pitch: -0.5570781264376654,
//         duration: 11
//     },
//     {
//         x: -2181961.5836593686,
//         y: 4386639.424757708,
//         z: 4070126.8421661835,
//         heading: 1.8930334215019684,
//         pitch: -0.3914671101069125,
//         duration: 10
//     },
//     {
//         x: -2181909.9799466915,
//         y: 4386656.579538563,
//         z: 4070136.2062756093,
//         heading: 1.9158803295164573,
//         pitch: -0.40108043538811855,
//         duration: 10
//     },
//     {
//         x: -2181853.80412751,
//         y: 4386675.447666,
//         z: 4070145.9673791323,
//         heading: 2.08359007370124,
//         pitch: -0.40255138393064227,
//         duration: 8
//     },
//     {
//         x: -2181994.1118843486,
//         y: 4386722.644556644,
//         z: 4070185.540180433,
//         heading: 3.130232793369061,
//         pitch: -1.437422952163875,
//         duration: 10
//     },
//     {
//         x: -2181863.368232766,
//         y: 4386842.75315717,
//         z: 4070217.950507644,
//         heading: 0.010624721840189366,
//         pitch: -1.5654866664918554,
//         duration: 5
//     },
//     {
//         x: -2181784.416927479,
//         y: 4386882.962212063,
//         z: 4070217.9348923187,
//         heading: 0.010624721840175155,
//         pitch: -1.5654866667427707,
//         duration: 5
//     },
//     {
//         x: -2181752.79316849,
//         y: 4386918.179997333,
//         z: 4070217.2929187655,
//         heading: 0.010624721840157392,
//         pitch: -1.5654866670414225,
//         duration: 5
//     },
//     {
//         x: -2181663.4141617324,
//         y: 4386960.260341496,
//         z: 4070217.5290977266,
//         heading: 0.010624721840157392,
//         pitch: -1.5654866670408158,
//         duration: 8
//     },
//     {
//         x: -2181584.3489090004,
//         y: 4386999.56026525,
//         z: 4070217.5494081196,
//         heading: 0.010624721840157392,
//         pitch: -1.5654866670357768,
//         duration: 8
//     },
//     {
//         x: -2181182.0949511044,
//         y: 4387076.713720111,
//         z: 4070089.6122127455,
//         heading: 1.2248671384392535,
//         pitch: -0.4312627015212609,
//         duration: 8
//     },
//     {
//         x: -2181101.6290741162,
//         y: 4387120.8592427205,
//         z: 4070085.14958719,
//         heading: 1.2248671389165304,
//         pitch: -0.43126270189510185,
//         duration: 8
//     },
//     {
//         x: -2181032.9893011358,
//         y: 4387222.792673762,
//         z: 4070081.969190965,
//         heading: 1.050034328623445,
//         pitch: -0.6345797728893219,
//         duration: 8
//     },
//     {
//         x: -2181068.7560794097,
//         y: 4387243.435456547,
//         z: 4070173.5178403254,
//         heading: 0.013044035555349609,
//         pitch: -1.4407032209013422,
//         duration: 8
//     },
//     {
//         x: -2181017.5013388293,
//         y: 4387269.808242594,
//         z: 4070157.793241215,
//         heading: 6.273926302098958,
//         pitch: -1.334821857295125,
//         duration: 8
//     },
//     {
//         x: -2180912.9018427837,
//         y: 4387301.9796640985,
//         z: 4070092.6085081045,
//         heading: 6.282996181021591,
//         pitch: -1.020300727828678,
//         duration: 8
//     }


// ]
let points = [
    {
        duration: 6,
        heading: 3.0573428893503047,
        pitch: -0.7623073264240761,
        x: -2634101.283768762,
        y: 4801705.408810293,
        z: 3261277.9391931645,
    },
    {
        duration: 6,
        heading: 3.1561242870357558,
        pitch: -0.6593478920450275,
        x: -2633982.6196125476,
        y: 4801094.421507055,
        z: 3260156.9830194083,
    },
    {
        duration: 6,
        heading: 3.7412002722059157,
        pitch: -0.510232352948504,
        x: -2635009.574311868,
        y: 4800545.827447162,
        z: 3259771.2262980896,
    },
    {
        duration: 6,
        heading: 4.858709503382363,
        pitch: -0.3918194444472358,
        x: -2635780.9884279203,
        y: 4800561.1383885015,
        z: 3259011.2932378314,
    }, {
        duration: 6,
        heading: 5.618087838801831,
        pitch: -0.5668632859098,
        x: -2635570.1443318604,
        y: 4801121.314804211,
        z: 3258579.165330887,
    },
    {
        duration: 6,
        heading: 5.994650361081228,
        pitch: -0.7419032662805112,
        x: -2635028.2288265037,
        y: 4801959.934455259,
        z: 3258428.8005504557,
    },
    {
        duration: 6,
        heading: 0.11692636921647459,
        pitch: -0.7830877348183236,
        x: -2634126.1384014976,
        y: 4802597.802215203,
        z: 3258277.3159559486,
    }, {
        duration: 6,
        heading: 1.468060446567991,
        pitch: -0.3686591500801022,
        x: -2632502.212351332,
        y: 4802505.9777510045,
        z: 3258717.4749449003,
    },
    {
        duration: 6,
        heading: 2.3536002407808345,
        pitch: -0.5591501009374138,
        x: -2632679.7363500902,
        y: 4802129.7233094275,
        z: 3259768.0366158397,
    },
    {
        duration: 6,
        heading: 2.944046331634027,
        pitch: -0.4973717085308813,
        x: -2633296.601718044,
        y: 4801336.390457498,
        z: 3260345.072528534,
    },
    {
        duration: 6,
        heading: 3.1759422520526983,
        pitch: -0.8319873870534558,
        x: -2634238.761161171,
        y: 4801515.981179449,
        z: 3260653.103672723,
    }
]
let points1 = [
    {
        duration: 6,
        heading: 3.0573428893503047,
        pitch: -0.7623073264240761,
        x: -2634101.283768762,
        y: 4801705.408810293,
        z: 3261277.9391931645,
    },
    {
        duration: 6,
        heading: 3.1561242870357558,
        pitch: -0.6593478920450275,
        x: -2633982.6196125476,
        y: 4801094.421507055,
        z: 3260156.9830194083,
    },
    {
        duration: 6,
        heading: 3.7412002722059157,
        pitch: -0.510232352948504,
        x: -2635009.574311868,
        y: 4800545.827447162,
        z: 3259771.2262980896,
    },
    {
        duration: 6,
        heading: 4.858709503382363,
        pitch: -0.3918194444472358,
        x: -2635780.9884279203,
        y: 4800561.1383885015,
        z: 3259011.2932378314,
    }, {
        duration: 6,
        heading: 5.618087838801831,
        pitch: -0.5668632859098,
        x: -2635570.1443318604,
        y: 4801121.314804211,
        z: 3258579.165330887,
    },
    {
        duration: 6,
        heading: 5.994650361081228,
        pitch: -0.7419032662805112,
        x: -2635028.2288265037,
        y: 4801959.934455259,
        z: 3258428.8005504557,
    },
    {
        duration: 6,
        heading: 0.11692636921647459,
        pitch: -0.7830877348183236,
        x: -2634126.1384014976,
        y: 4802597.802215203,
        z: 3258277.3159559486,
    }, {
        duration: 6,
        heading: 1.468060446567991,
        pitch: -0.3686591500801022,
        x: -2632502.212351332,
        y: 4802505.9777510045,
        z: 3258717.4749449003,
    },
    {
        duration: 6,
        heading: 2.3536002407808345,
        pitch: -0.5591501009374138,
        x: -2632679.7363500902,
        y: 4802129.7233094275,
        z: 3259768.0366158397,
    },
    {
        duration: 6,
        heading: 2.944046331634027,
        pitch: -0.4973717085308813,
        x: -2633296.601718044,
        y: 4801336.390457498,
        z: 3260345.072528534,
    },
    {
        duration: 6,
        heading: 3.1759422520526983,
        pitch: -0.8319873870534558,
        x: -2634238.761161171,
        y: 4801515.981179449,
        z: 3260653.103672723,
    }
]
let changeValue = (e: any) => {
    // points = e
    if (e == 'mr') {
        points = points1
    } else {
        points = e//新数据替换默认数据
    }
}

//开始巡航
var timer: any;//自动巡航的 时间id

// fId 巡航id  tag （zd js zt jx） 巡航操作
let flight = (fId: number, tag: any) => {
    const fly = (index: any) => {
        //自动巡航
        if (index >= points.length) {
            index = 0
            index++
        }
        // console.log(points[index], 1111111111);
        viewer.value.camera.flyTo({
            destination: {
                x: points[index].x,
                y: points[index].y,
                z: points[index].z
            },
            maximumHeight: 2,
            duration: points[index].duration,
            orientation: {
                heading: points[index].heading,
                pitch: points[index].pitch,
            },
            complete: function () {
                // fly(index, true)
            },
            easingFunction: Cesium.EasingFunction.LINEAR_NONE
        })

    }

    var index = fId
    if (tag == 'zd') {
        if (sessionStorage.getItem("fId") != null) {
            alert('请先结束巡航')
            return
        }
        //自动巡航
        fly(index)
        sessionStorage.setItem("fId", String(index))
        timer = setInterval(() => {
            fly(index + 1,)
            index++
            sessionStorage.setItem("fId", String(index))//保存当前巡航的点位
        }, 6000)
    } else if (tag == 'js') {
        // 结束巡航
        timer = clearInterval(timer)
        sessionStorage.removeItem("fId")
        // 天安门=>长安街
        // viewer.value.scene.camera.flyTo({
        //     destination: Cesium.Cartesian3.fromDegrees(
        //         116.4371077214,
        //         39.9053759642,
        //         1200
        //     ), //定位坐标点，建议使用谷歌地球坐标位置无偏差
        //     orientation: {
        //         heading: Cesium.Math.toRadians(0.1),
        //         pitch: Cesium.Math.toRadians(-86.0),
        //         //roll: 0.0
        //     },
        //     duration: 3, //定位的时间间隔
        // });
        viewer.value.scene.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(118.7482969, 30.9254499, 2607),
            orientation: {
                heading: Cesium.Math.toRadians(358.70), // 水平偏角，默认正北 0
                pitch: Cesium.Math.toRadians(-88.81), // 俯视角，默认-90，垂直向下
                roll: 0, // 旋转角
            },
        });
        return false
    } else if (tag == 'zt') {
        // 暂停巡航
        // if (sessionStorage.getItem("fId") == null) {
        //     alert('请先开始巡航')
        //     return
        // }
        timer = clearInterval(timer)
        let angleofview = getView()
        //存储当前视角
        sessionStorage.setItem("angleofview", JSON.stringify(angleofview))
        setView(angleofview.x, angleofview.y, angleofview.z, angleofview.pitch, angleofview.heading)
    } else if (tag == 'jx') {
        // 继续巡航
        // if (sessionStorage.getItem("fId") == null) {
        //     alert('请先开始巡航')
        //     return
        // }
        let obj = eval("(" + sessionStorage.getItem("angleofview") + ")")
        obj.duration = 6
        index = Number(sessionStorage.getItem("fId"))
        fly(index)
        // index++
        timer = setInterval(() => {
            fly(index + 1)
            index++
            sessionStorage.setItem("fId", String(index))
        }, 6000)
    }
}
// 结束巡航
// let endRoute = ()=>{

// }
//获取相机视角
let getView = () => {
    //获取当前视角的pitch
    var pitch = viewer.value.camera.pitch;
    //获取当前视角的heading
    var heading = viewer.value.camera.heading;
    //获取当前视角的postion（位置）
    var position = viewer.value.camera.position;
    var x = position.x;
    var y = position.y;
    var z = position.z;
    // var testPitch = pitch;
    // var testHeading = heading;
    // console.log("获取当前视角x,y,z", position.x, position.y, position.z, "pitch", pitch, "heading", heading);

    var ObjectJson = {
        "x": x,
        "y": y,
        "z": z,
        "pitch": pitch,
        "heading": heading
    }
    // console.log("ObjectJson", ObjectJson);
    return ObjectJson
    // if (!window.localStorage) {
    //   window.alert("该浏览器不支持LocalStorage")
    // } else {
    //   storage = window.localStorage;
    //   // storage.setItem("positionJson",JSON.stringify(ObjectJson));
    //   console.log("storage.positionJson", storage.positionJson);
    // }
}
//设置相机视角
let setView = (x: number, y: number, z: number, testPitch: any, testHeading: any) => {
    var x = x;
    var y = y;
    var z = z;
    var testPitch = testPitch;
    var testHeading = testHeading;
    viewer.value.camera.flyTo({ //定位到范围中心点
        destination: {
            x: x,
            y: y,
            z: z
        },
        orientation: {
            heading: testHeading, //左右方向
            pitch: testPitch, //上下方向
            roll: 0.0
        },
        duration: 9 //定位的时间间隔
    })
}
//-全景视频------------------------------------------------------------------------------------------------

// let videoElement1 = document.getElementById('trailer1');

let url1 = "http://10.189.2.94:8510/stream/beilu1/channel/btcc/webrtc";

// let videoElement2 = document.getElementById('trailer2');
let url2 = "http://10.189.2.94:8510/stream/beilu1/channel/tsg/webrtc";

// let videoElement4 = document.getElementById('trailer4');
let url4 = "http://10.189.2.94:8510/stream/beilu1/channel/xbtcc/webrtc";

// let videoElement5 = document.getElementById('trailer5');
let url5 = "http://10.189.2.94:8510/stream/beilu1/channel/bhl/webrtc";

// let videoElement6 = document.getElementById('trailer6');
let url6 = "http://10.189.2.94:8510/stream/beilu1/channel/xhlz/webrtc";

// let videoElement7 = document.getElementById('trailer7');
let url7 = "http://10.189.2.94:8510/stream/beilu1/channel/bhddz/webrtc";

// let videoElement8 = document.getElementById('trailer8');
let url8 = "http://10.189.2.94:8510/stream/beilu1/channel/ztnln/webrtc";

// let videoElement9 = document.getElementById('trailer9');
let url9 = "http://10.189.2.94:8510/stream/beilu1/channel/bhddq/webrtc";

// let videoElement10 = document.getElementById('trailer10');
let url10 = "http://10.189.2.94:8510/stream/beilu1/channel/bhlk/webrtc";
let url11 = "http://10.189.2.94:8510/stream/beilu1/channel/humian/webrtc";
// console.log(videoElement1);
var vd1: any, vd2: any, vd4: any, vd5: any, vd6: any, vd7: any, vd8: any, vd9: any, vd10: any, vd11: any
// 全景视频
const PanoramicVideo = () => {
    // console.log($('DIV'),1);
    // console.log(videoElement1);


    vd1 = viewer.value.entities.add({
        // 面实体 北停车场
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    // 118.74833003698528, 30.92769905739906,
                    // 118.75005585414905, 30.930453445943932,
                    // 118.74951858545174, 30.930388302203212,
                    // 118.75147351170376, 30.93062681392179,
                    // 118.75266384835237, 30.930138316341786,
                    // 118.75436896001614, 30.929468241695783,
                    // 118.7545699420423, 30.92804481319384,
                    118.75079162744302, 30.927937654334325,
                    118.74874971796132, 30.9283548027485,
                    118.75032646852848, 30.930505748133747,
                    118.75162717562706, 30.930516832470943,
                    118.75353837690925, 30.92972642662118,
                    118.75372851818607, 30.929629519483566,
                    118.75391862982526, 30.929535085264607,
                    118.75406817233696, 30.929172011359057,
                    118.75178909388565, 30.928080706168746,
                    118.75124934296048, 30.927947279122083,
                    118.75097343102014, 30.927930482163838
                ]
            ),
            material: document.getElementById('trailer1'), // 将材质设置为video元素
            // name: url1,
            clampToGround: true,
            rotation: Cesium.Math.toRadians(175), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(175), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },

    });
    // viewer.value.entities.remove(abc)
    //tsg
    // var hls = new hlsjs();
    // hls.loadSource(url2);//视频流交给hls
    // hls.attachMedia(videoElement2);//把hls赋给了video标签
    // hls.on(hls.Events, function () {
    //   videoElement2.play();
    // })
    vd2 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [


                    118.75811119286337, 30.930288700691772,
                    118.7583258758862, 30.930164034033872,
                    118.75756514466805, 30.930606062272656,
                    118.75708874305452, 30.930175720851622,
                    118.75671076127966, 30.92986335771292,
                    118.75737238922807, 30.929702553869124,
                    118.75787894262527, 30.929566071577423,
                    118.75799210065834, 30.929660430752865,
                    118.75820732065282, 30.929835141306388,
                ]

            ),
            material: document.getElementById('trailer2'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(-145), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(-145), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });
    // 	//xbtcc
    // var hls = new hlsjs();
    // hls.loadSource(url4);//视频流交给hls
    // hls.attachMedia(videoElement4);//把hls赋给了video标签
    // hls.on(hls.Events, function () {
    //   videoElement4.play();
    // })
    vd4 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [

                    118.74203669285168, 30.930336145147542,
                    118.74230953644548, 30.930533120227885,
                    118.74221830604743, 30.930723665605065,
                    118.74298065837657, 30.931347377982608,
                    118.74374776875277, 30.930791570577377,
                    118.74387540058483, 30.930486834801908,
                    118.74406468798568, 30.93055928355657,
                    118.74355537084121, 30.930363655130115,
                    118.74251527693353, 30.930395630439733,
                    118.7422436631632, 30.930108701799636,
                    118.74283488054043, 30.929546506659932,
                    118.74185472989534, 30.930478428533707,
                    118.74198522747216, 30.930355207522116,
                    118.7420196641109, 30.930323575213162,
                ]

            ),
            material: document.getElementById('trailer4'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(138), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(138), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });

    // 	//bhl
    // var hls = new hlsjs();
    // hls.loadSource(url5);//视频流交给hls
    // hls.attachMedia(videoElement5);//把hls赋给了video标签
    // hls.on(hls.Events, function () {
    //   videoElement5.play();
    // })
    // 	//bhl
    vd5 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    118.74161565044673, 30.921459555759938,
                    118.74150610243329, 30.920823626580393,
                    118.74118048898954, 30.920481583079905,
                    118.74030762950608, 30.92041766382068,
                    118.74015408979768, 30.92078337255229,
                    118.74016724162139, 30.92124774860581,
                    118.74041990939837, 30.921687796898226,
                    118.74143501481745, 30.921525397651163,
                    118.74119681845264, 30.9216020889444,
                    118.74131193969397, 30.921529511479196
                ]

            ),
            material: document.getElementById('trailer5'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(18), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(18), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });

    //xhlz
    // var hls = new hlsjs();
    // hls.loadSource(url6);//视频流交给hls
    // hls.attachMedia(videoElement6);//把hls赋给了video标签
    // hls.on(hls.Events, function () {
    //   videoElement6.play();
    // })
    vd6 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    118.73350672584323, 30.92381022875457,
                    118.73335975044868, 30.923750253697907,
                    118.73290854678505, 30.923870902017338,
                    118.73288667785368, 30.92407472602999,
                    118.73332057435245, 30.92428831930626,
                    118.73325593744654, 30.92465957200228,
                    118.73344563060405, 30.924808159253658,
                    118.73410503870012, 30.92480607044783,
                    118.73421151751096, 30.924658897919986,
                    118.73419844518035, 30.924364589009723
                ]

            ),
            material: document.getElementById('trailer6'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(1), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(1), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });

    //bhddz
    // var hls = new hlsjs();
    // hls.loadSource(url7);//视频流交给hls
    // hls.attachMedia(videoElement7);//把hls赋给了video标签
    // hls.on(hls.Events, function () {
    //   videoElement7.play();
    // })
    vd7 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    118.75207967852666, 30.921936231891564,
                    118.75178244825207, 30.921678001032596,
                    118.7515310217848, 30.921430026621348,
                    118.75067584144097, 30.92122452897052,
                    118.75020985876257, 30.921888549761494,
                    118.75069571205898, 30.92199218790428,
                    118.75084156967104, 30.92200474643244,
                    118.75082719762285, 30.92252004405106,
                    118.75173366795485, 30.922808083717225,
                    118.75206456674081, 30.922017145064867
                ]

            ),
            material: document.getElementById('trailer7'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(-20), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(-20), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });

    // //ztnln
    // var hls = new hlsjs();
    // hls.loadSource(url8);//视频流交给hls
    // hls.attachMedia(videoElement8);//把hls赋给了video标签
    // hls.on(hls.Events, function () {
    //   videoElement8.play();
    // })
    vd8 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    118.73706389325874, 30.927006262544054,
                    118.73655782587221, 30.927001277071867,
                    118.73642296067312, 30.926954207364584,
                    118.73640742899882, 30.926859518056023,
                    118.73619951404922, 30.926709362665967,
                    118.73611208002117, 30.926583553194725,
                    118.73643204216806, 30.926170075563075,
                    118.73677073562942, 30.926439425924865,
                    118.73709972297489, 30.926711256899267,
                    118.73713671867938, 30.92690429931334
                ]

            ),
            material: document.getElementById('trailer8'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(135), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(135), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });

    // //bhddq
    // var hls = new hlsjs();
    // hls.loadSource(url9);//视频流交给hls
    // hls.attachMedia(videoElement9);//把hls赋给了video标签
    // hls.on(hls.Events, function () {
    //   videoElement9.play();
    // })
    vd9 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    118.75752804751482, 30.923154846153203,
                    118.7585483106344, 30.92338087589208,
                    118.7588257908202, 30.922388960131006,
                    118.75765020228253, 30.922132198567404,
                    118.75787523434317, 30.92218137341,
                    118.75771444447275, 30.922380325539848,
                    118.75757058046965, 30.92245863313018
                ]

            ),
            material: document.getElementById('trailer9'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(-13), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(-13), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });

    // //bhlk
    // var hls = new hlsjs();
    // hls.loadSource(url10);//视频流交给hls
    // hls.attachMedia(videoElement10);//把hls赋给了video标签

    // hls.on(hls.Events, function () {
    //   videoElement10.play();
    // })
    vd10 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    118.76415967456916, 30.926284757906238,
                    118.76412173345904, 30.92669990001768,
                    118.76367200161609, 30.926992377316637,
                    118.7641724868587, 30.927447452377496,
                    118.76382862373381, 30.92713469065268,
                    118.76441983899036, 30.927257912985585,
                    118.7655589240677, 30.926409270545115,
                    118.76521248814153, 30.92605719417222,
                    118.76442917278226, 30.926093231168434,
                    118.76492938453305, 30.925736536213726
                ]

            ),
            material: document.getElementById('trailer10'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(-140), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(-140), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });
    vd11 = viewer.value.entities.add({
        polygon: {
            hierarchy: Cesium.Cartesian3.fromDegreesArray(
                [
                    118.7455509946368, 30.9305995928555,
                    118.74544483154584, 30.930553754652443,
                    118.7453466715335, 30.930508737345264,
                    118.74529447651852, 30.930485369488288,
                    118.74518063495908, 30.930446101918502,
                    118.74482314091517, 30.93038191674533,
                    118.74438758551881, 30.930358366605407,
                    118.74397949496739, 30.930428272664187,
                    118.74357235731406, 30.930512665408155,
                    118.74334708053479, 30.93050192261179,
                    118.74295896085553, 30.930454347867816,
                    118.74245439399758, 30.930277923213836,
                    118.74234267237391, 30.930201693960193,
                    118.7421230004372, 30.929914984320444,
                    118.74192580494633, 30.92972205541014,
                    118.74166412008398, 30.929660444133294,
                    118.74142494226543, 30.929675872701015,
                    118.74135401305969, 30.92951864163536,
                    118.74174516704126, 30.929312230668025,
                    118.74211666896517, 30.928926576400247,
                    118.74240585018049, 30.928479463441885,
                    118.7424386710544, 30.928403285264316,
                    118.74256958486049, 30.92843992357637,
                    118.74261006393336, 30.928407702913425,
                    118.74266168166672, 30.928152076188006,
                    118.74264419009968, 30.928005638102757,
                    118.74257530906287, 30.927879987665428,
                    118.74250499728029, 30.92778223912501,
                    118.74238061581985, 30.927659347160557,
                    118.74228443857596, 30.927561501609524,
                    118.74197812998266, 30.927249071537403,
                    118.7418457162928, 30.927139699416152,
                    118.74124828783563, 30.92683429537528,
                    118.74103955751129, 30.9267473439577,
                    118.74088499206829, 30.9266911125429,
                    118.74047849074925, 30.92665030708358,
                    118.73978566083508, 30.926675230793432,
                    118.73949313569233, 30.92668486627412,
                    118.7392098528782, 30.926691729983027,
                    118.73899309724, 30.92666861183049,
                    118.73873554159667, 30.92660518820821,
                    118.73861361702126, 30.926557728281487,
                    118.73845401568137, 30.926410666764383,
                    118.73839299859416, 30.926287537824944,
                    118.73832550785099, 30.926081644345118,
                    118.73829571796466, 30.92589305967706,
                    118.73823777624095, 30.925685711119364,
                    118.73807446801767, 30.92536144473486,
                    118.7379201419977, 30.925222398875754,
                    118.73782222158928, 30.925138849708144,
                    118.73769806519246, 30.92507966598841,
                    118.73769672886651, 30.925005748963432,
                    118.73741617968093, 30.92486917705325,
                    118.73734458507273, 30.92488978367807,
                    118.7371611896151, 30.924870790121133,
                    118.73686292554912, 30.924781658531757,
                    118.73670286717125, 30.92475691695459,
                    118.73643975880756, 30.924743026846457,
                    118.73628022674046, 30.92476810426002,
                    118.73611430157027, 30.924788814720863,
                    118.7359393046267, 30.924747181520047,
                    118.73581823157497, 30.924712394559236,
                    118.73571462283151, 30.92466210394537,
                    118.73568366979387, 30.924633103606183,
                    118.73565911574065, 30.92460164448422,
                    118.73564158613532, 30.924607057141447,
                    118.73540278792854, 30.924403474333513,
                    118.73516230785144, 30.92430670628746,
                    118.73504209623741, 30.924233763854957,
                    118.73488880054781, 30.924196647612707,
                    118.73493575090608, 30.92380557148614,
                    118.7350874278227, 30.923793175210076,
                    118.73523985673265, 30.92374167167403,
                    118.73528164280582, 30.9237595625177,
                    118.7353327359027, 30.923749636883322,
                    118.73547636504408, 30.923623041288362,
                    118.73551033680181, 30.923618158588948,
                    118.73557912688311, 30.923565546944975,
                    118.7355973594245, 30.923560402468514,
                    118.73560779652473, 30.92353908390386,
                    118.73572161054136, 30.923471238861737,
                    118.73575382184293, 30.923459171523014,
                    118.7357780244064, 30.92342521781927,
                    118.73581799652464, 30.923396552726796,
                    118.73597818060163, 30.92332072177392,
                    118.73610039240884, 30.923276346228135,
                    118.73613433147705, 30.923257798780877,
                    118.73614410507872, 30.923260314278863,
                    118.73616117800074, 30.923251569534845,
                    118.73616307331521, 30.923244025055915,
                    118.73621693186587, 30.923216836600336,
                    118.73629385875161, 30.923190537562466,
                    118.73631174737812, 30.92318451303017,
                    118.73636621991493, 30.923169257917284,
                    118.73641780418872, 30.923135035722225,
                    118.7364332337639, 30.923121965834948,
                    118.73645361783123, 30.923099937058925,
                    118.73648683965156, 30.923076513930816,
                    118.73653732395996, 30.9230742227255,
                    118.73656631133, 30.92305399177356,
                    118.73667374316423, 30.92298340443472,
                    118.73677848922964, 30.922946964043838,
                    118.73687205682022, 30.922869784933727,
                    118.73687499509923, 30.92284514435782,
                    118.73694039388896, 30.922798530476413,
                    118.73698263264706, 30.922783116326176,
                    118.73719309120804, 30.922513506141105,
                    118.73734239737074, 30.92241716633287,
                    118.7375938008756, 30.922293390672976,
                    118.73775963651318, 30.922240498980795,
                    118.73810381390173, 30.922122182588307,
                    118.73826182958373, 30.922144001833324,
                    118.73838007002269, 30.92209536841993,
                    118.738549043857, 30.922072164554358,
                    118.73896368764787, 30.9221107503791,
                    118.73926435323055, 30.922101162891572,
                    118.73953891416757, 30.922162700751834,
                    118.73968437643602, 30.92229899918302,
                    118.7398037824294, 30.92249373246973,
                    118.73978301212419, 30.922598538600692,
                    118.73981179407996, 30.922636646551364,
                    118.74026834752556, 30.922938732724845,
                    118.74045978332956, 30.922919758154737,
                    118.74079296954825, 30.92310208295137,
                    118.74106981135657, 30.923265630146005,
                    118.74144928801795, 30.92343328319546,
                    118.74170505143326, 30.923483019083573,
                    118.74183056196567, 30.923524902243965,
                    118.74193977019635, 30.923514789441395,
                    118.74203851458697, 30.92353222994434,
                    118.74216508213445, 30.923521892919965,
                    118.74231752365483, 30.92354241907273,
                    118.7423954084418, 30.92353553534621,
                    118.74248619470012, 30.923533299239317,
                    118.74268463209494, 30.92350464977611,
                    118.74295602088658, 30.923477299974063,
                    118.74303216583098, 30.923476973338815,
                    118.743277517249, 30.923387154143057,
                    118.74332324533145, 30.923369460119616,
                    118.74333428045388, 30.923337257504958,
                    118.74341393902729, 30.923334367057688,
                    118.74346854635056, 30.923316844606312,
                    118.74345604217784, 30.923292471692786,
                    118.74349968083723, 30.923277612192564,
                    118.74350805024078, 30.92325457422026,
                    118.74359871911896, 30.92321464976453,
                    118.74362907331404, 30.923223121505504,
                    118.74370221487092, 30.92319037583673,
                    118.74371860061993, 30.923161982972527,
                    118.7437774413761, 30.92310081107544,
                    118.7437939206613, 30.923082843292157,
                    118.74393466815157, 30.92288150691647,
                    118.74400236167776, 30.92259582827164,
                    118.74405403683697, 30.922308599511037,
                    118.74406741600477, 30.922067275341576,
                    118.74407352031803, 30.921738118249664,
                    118.74405547506773, 30.921651524250183,
                    118.74392009012361, 30.921472643195077,
                    118.74406080255508, 30.921395190672012,
                    118.74412099804324, 30.9214337001954,
                    118.74418221059042, 30.921454038049838,
                    118.74426229521477, 30.92145496531889,
                    118.744317762067, 30.921439672689427,
                    118.74437977543391, 30.92139008571905,
                    118.74443966038316, 30.921283313040032,
                    118.74445551777265, 30.92126006642311,
                    118.7444591907491, 30.92112036015596,
                    118.74445352782676, 30.92090705891841,
                    118.74446061713519, 30.920755716600972,
                    118.7444808444761, 30.92065670760736,
                    118.74454249814151, 30.920557371899797,
                    118.74459108215872, 30.92051587257134,
                    118.74462387193148, 30.920511383384476,
                    118.74465104902882, 30.920474259222804,
                    118.74468671754288, 30.920420306949623,
                    118.74480132853336, 30.92041976783487,
                    118.74488121411851, 30.92041571192186,
                    118.74498085449771, 30.920427112645825,
                    118.74511321964542, 30.920446886603184,
                    118.7452020173555, 30.920455623532153,
                    118.7453187330544, 30.92047057831013,
                    118.74535654781955, 30.920489172679577,
                    118.74562732642153, 30.92050452864093,
                    118.74578164885679, 30.920459990523966,
                    118.74593175978582, 30.920388895767623,
                    118.74611940026048, 30.920291513650742,
                    118.74618753467651, 30.920246043080603,
                    118.7462907493785, 30.920151472284513,
                    118.74636430622245, 30.920179076127237,
                    118.74682410086811, 30.92032510544491,
                    118.74674998966731, 30.920514665563783,
                    118.74670160527646, 30.92058401123618,
                    118.74667724548675, 30.92095868364187,
                    118.74671784740464, 30.921059836181172,
                    118.74681255390806, 30.921161285366473,
                    118.7469012167504, 30.921258019065668,
                    118.7470648751861, 30.921360274368947,
                    118.74722724858991, 30.921425799260213,
                    118.74731467642134, 30.921473883730986,
                    118.74736032469976, 30.921512704848407,
                    118.74762311458997, 30.921616541196,
                    118.74770328662501, 30.92166391461569,
                    118.74782241047632, 30.921803311023538,
                    118.7479172238237, 30.922028714016697,
                    118.74798975360305, 30.92223061051509,
                    118.74802183401289, 30.922469998574215,
                    118.74812212169371, 30.922819073122987,
                    118.74831423365282, 30.92306320457095,
                    118.74846109984655, 30.92316860178426,
                    118.74865701233689, 30.923247318465734,
                    118.74890709402506, 30.92331242411502,
                    118.74911185376824, 30.923354826052265,
                    118.74927649459516, 30.923428031291234,
                    118.74970637552799, 30.923522514077455,
                    118.74987355640211, 30.92354843477407,
                    118.74993029017735, 30.92354042447853,
                    118.75016588322543, 30.923557415129157,
                    118.75032344003944, 30.92358719675795,
                    118.75039739050999, 30.923615070365013,
                    118.75054811022696, 30.9237076630411,
                    118.75061119057699, 30.92374166454236,
                    118.75066211722401, 30.923761045409094,
                    118.75075327799678, 30.923792002370725,
                    118.75075936800192, 30.923802417635862,
                    118.7507726611168, 30.923808980812414,
                    118.75078496246856, 30.9238021283698,
                    118.75086864666648, 30.92383836249343,
                    118.75088868923825, 30.923847421612262,
                    118.75090610914953, 30.923849508818066,
                    118.75092502359843, 30.92386750166084,
                    118.75101851913985, 30.923908905180078,
                    118.75104697968514, 30.923927598689843,
                    118.75108669891138, 30.923961718490467,
                    118.75110634903258, 30.923979666522797,
                    118.75139587042537, 30.924002242427107,
                    118.75144126917453, 30.92401076122303,
                    118.75152621442236, 30.924004388946106,
                    118.75156212302343, 30.924010081265585,
                    118.75164030065444, 30.924003697189328,
                    118.75173598481531, 30.92398899782545,
                    118.75186438503864, 30.923953345547165,
                    118.75196176702428, 30.923924712551955,
                    118.75206337694951, 30.92386528057416,
                    118.75219321747153, 30.923811220214155,
                    118.7523160325053, 30.923763494385728,
                    118.7523555536125, 30.923763578624094,
                    118.75236727396845, 30.923737937729637,
                    118.75251406633376, 30.92366111427468,
                    118.75279978996336, 30.923483980435208,
                    118.7529865008082, 30.923430919187666,
                    118.75316660482991, 30.923410902255263,
                    118.75328806520037, 30.92336595885894,
                    118.75330848999523, 30.923297908677647,
                    118.75335804158007, 30.923290994671085,
                    118.75344578250451, 30.92330595328669,
                    118.7535726249928, 30.923333918465296,
                    118.75355189175743, 30.92341540631461,
                    118.75392751174596, 30.923487490877957,
                    118.7539370145498, 30.92340976915253,
                    118.75394450366954, 30.92341369870774,
                    118.75400621382896, 30.923404477018966,
                    118.75405077184742, 30.9233878449153,
                    118.75415757730222, 30.923367535067236,
                    118.75418453845595, 30.923415673563206,
                    118.75422868783542, 30.92344294491423,
                    118.7542790264452, 30.923445373577902,
                    118.75433962959431, 30.92345690839873,
                    118.75437018257266, 30.923501761865626,
                    118.75440411262146, 30.923568624487164,
                    118.75443598213916, 30.923707385949808,
                    118.75454819525126, 30.92374793698547,
                    118.75461869840788, 30.923749306322694,
                    118.75474818943238, 30.92378526835993,
                    118.7547487564504, 30.923847909557896,
                    118.75496172676819, 30.923847943265848,
                    118.7549617004877, 30.923904828702533,
                    118.75523474807784, 30.923903247674282,
                    118.75524110959286, 30.92386317998062,
                    118.75541001312791, 30.92386192092652,
                    118.75541026351247, 30.92396150819425,
                    118.7555273181431, 30.92396021044264,
                    118.75552753743943, 30.923872901030865,
                    118.75549006716366, 30.923857943492017,
                    118.7554945078245, 30.923724551268567,
                    118.75563313589802, 30.92373001630624,
                    118.7556345133613, 30.923673013242848,
                    118.75568030933114, 30.92367205842915,
                    118.75567799650582, 30.92341669445528,
                    118.75565722065754, 30.92338288625401,
                    118.75590236655829, 30.92313169082705,
                    118.75596666544477, 30.92307905537264,
                    118.75615454751834, 30.92302349222878,
                    118.75636961348629, 30.922978787999543,
                    118.75663644589903, 30.92295857858321,
                    118.75721484954691, 30.922942127908858,
                    118.7575451806568, 30.922902713642333,
                    118.75763063200465, 30.922761154207603,
                    118.75836864823012, 30.922912311795688,
                    118.75839034674783, 30.923169334460905,
                    118.75843774431279, 30.923296584604234,
                    118.758560841322, 30.923423342943828,
                    118.758796832081, 30.923627938960784,
                    118.75897383763782, 30.923740360085166,
                    118.75943072416813, 30.92392130252129,
                    118.75953088595772, 30.923951385469472,
                    118.75964297765432, 30.924044786594628,
                    118.75976284020614, 30.924115086407358,
                    118.75987647777006, 30.924151155303903,
                    118.76000565729937, 30.924170781811554,
                    118.76012639859442, 30.92416653470143,
                    118.76019794893045, 30.924156919002566,
                    118.76057073198652, 30.92435690594178,
                    118.76064974726623, 30.924421277563486,
                    118.76073054609638, 30.924502534015915,
                    118.7608152189142, 30.924583431432346,
                    118.76091303628714, 30.924690294689174,
                    118.76097561633766, 30.92479556702756,
                    118.76104264567951, 30.924849977821854,
                    118.7610078778441, 30.924925968460993,
                    118.76102524229593, 30.924952507581846,
                    118.76109279522883, 30.925039457391154,
                    118.76113587461658, 30.925102502149617,
                    118.76117460306526, 30.92515842992385,
                    118.76123429496712, 30.925218014070584,
                    118.7612357808872, 30.9252490864341,
                    118.76125329642672, 30.925275522860332,
                    118.7612944746773, 30.92530383937983,
                    118.76143001829033, 30.925392218898658,
                    118.76148586904503, 30.925457230824925,
                    118.76155002689778, 30.925557538974193,
                    118.76161780396997, 30.925724028860664,
                    118.76166359236277, 30.9259855916313,
                    118.76166623585804, 30.926221444792123,
                    118.76166700790212, 30.92629533330302,
                    118.76167204934596, 30.926392300549868,
                    118.7616936994899, 30.926519381235092,
                    118.76167462067595, 30.926599633610184,
                    118.76160605951142, 30.92667496345921,
                    118.76154915787906, 30.92677196764565,
                    118.76147305522383, 30.92685678049613,
                    118.7613600209174, 30.92700061504226,
                    118.76120981601846, 30.9271327383482,
                    118.76099785245356, 30.927295478699467,
                    118.7609089333497, 30.92739382969081,
                    118.76085759538047, 30.92747723401217,
                    118.76073933002009, 30.927604562607023,
                    118.76047231365503, 30.92792293216841,
                    118.76043620082234, 30.92800072442234,
                    118.76039798677112, 30.928117415108847,
                    118.76037970891078, 30.928251943895773,
                    118.76046446878567, 30.928424503216974,
                    118.76010861657748, 30.928653549262663,
                    118.75997967672022, 30.92856009710438,
                    118.75991813610163, 30.928540718695675,
                    118.75981663538981, 30.928544126648177,
                    118.7597324549768, 30.928566319047135,
                    118.75967481791844, 30.928555678365452,
                    118.75960617231007, 30.9286018750926,
                    118.75945857766291, 30.928596621720427,
                    118.75930845972516, 30.928620431435093,
                    118.75919047589394, 30.928650366282234,
                    118.7589719269509, 30.92878799343671,
                    118.75890970771559, 30.928864882198617,
                    118.75884331567501, 30.92897069948849,
                    118.75880815795608, 30.929082612205246,
                    118.75876440661452, 30.9292331242735,
                    118.75873450841978, 30.92930264348594,
                    118.75871471604799, 30.929331433089743,
                    118.7586555161888, 30.92938571963264,
                    118.7585961949027, 30.929436675575005,
                    118.75854526059507, 30.929468184734198,
                    118.7584280445121, 30.929517421614847,
                    118.75804626095314, 30.929613345421856,
                    118.7578834489108, 30.9295678910988,
                    118.75779796024254, 30.92959190923,
                    118.757711655251, 30.929633986017908,
                    118.75754503236391, 30.929661881597823,
                    118.75706175426855, 30.92975975691795,
                    118.75680197778209, 30.929811540118514,
                    118.75676115899398, 30.929815197720533,
                    118.75671870316455, 30.929796362015306,
                    118.75668402443415, 30.929789176293895,
                    118.75665242539807, 30.929760192534943,
                    118.75661700498586, 30.929724770520338,
                    118.75658735730805, 30.9296909270082,
                    118.75653073995754, 30.929609035758936,
                    118.7564552610673, 30.92955029195745,
                    118.7563564633901, 30.929548228546203,
                    118.75632047883741, 30.929571602387508,
                    118.75629584905109, 30.92972433162159,
                    118.75615188814471, 30.9297665214961,
                    118.75595070023621, 30.929789230954988,
                    118.7557639382104, 30.929830821900683,
                    118.75562304041377, 30.929867962616036,
                    118.7554351532932, 30.92994408617599,
                    118.75525753926588, 30.93003856487799,
                    118.75518154261069, 30.930085299526578,
                    118.7551762810978, 30.930046442610934,
                    118.75478622080783, 30.930052002187928,
                    118.75479717810262, 30.930236079832014,
                    118.75489177681608, 30.930239045781224,
                    118.75490143457512, 30.930416457684853,
                    118.75483008845454, 30.930435901465593,
                    118.75480985857435, 30.930458395414092,
                    118.75473716725737, 30.930495763432614,
                    118.75458160441563, 30.93053786183232,
                    118.75432964473447, 30.930592264971537,
                    118.75405946495763, 30.9306054541345,
                    118.75356829156904, 30.93061634391171,
                    118.75300567521883, 30.93054655620616,
                    118.75267420137295, 30.930482459486715,
                    118.7523915748082, 30.93044982816918,
                    118.75197028202899, 30.93039127826159,
                    118.75163496144295, 30.930394441225427,
                    118.75150511726284, 30.930203798593475,
                    118.751260049749, 30.92985892330014,
                    118.75165497246041, 30.929786816939952,
                    118.75187957353941, 30.93008027237126,
                    118.75374233454676, 30.929683922564315,
                    118.75327930187815, 30.929387129227276,
                    118.7538713231689, 30.929086381461882,
                    118.7533628225804, 30.928799117156533,
                    118.75305277699137, 30.928659974969374,
                    118.7526758985634, 30.928484227372863,
                    118.75229374297322, 30.92828568022879,
                    118.7519956553351, 30.928171685896558,
                    118.751676350922, 30.928048880927072,
                    118.75139151530189, 30.92795259831806,
                    118.7512653002171, 30.927933022707435,
                    118.75096221599561, 30.92790888027885,
                    118.74961882052912, 30.92826701541751,
                    118.74920233650685, 30.928397033455944,
                    118.74912217833023, 30.92832026125178,
                    118.74895890601061, 30.928405319286192,
                    118.74926760885441, 30.92882241076353,
                    118.74909329265277, 30.929030493455524,
                    118.74906422485331, 30.929049367464255,
                    118.74911485816922, 30.92912537465513,
                    118.74920542254107, 30.92909326259784,
                    118.74939703931254, 30.929085989336475,
                    118.74962977726153, 30.929447432175348,
                    118.74996145869025, 30.929920202138128,
                    118.75002071849822, 30.92995939010134,
                    118.75025947382125, 30.930304641839385,
                    118.7494266254841, 30.93027339903722,
                    118.7489257582526, 30.930255766318723,
                    118.7488598044728, 30.930118846390886,
                    118.7484973815413, 30.93013320972009,
                    118.74849523091942, 30.93026780696173,
                    118.7483852743804, 30.930329132657718,
                    118.74826458359972, 30.930385122275375,
                    118.74802987700726, 30.930476720682602,
                    118.74780298657038, 30.93057777875218,
                    118.74773100484421, 30.930577432947192,
                    118.74765608127822, 30.930562676723717,
                    118.74732222005372, 30.930572883807244,
                    118.74733278572506, 30.930747715742502,
                    118.7472963002557, 30.930832406253824,
                    118.74720657526338, 30.930872469389698,
                    118.74697598402746, 30.930908667946397,
                    118.74677899338984, 30.93091711706878,
                    118.74674443343514, 30.93081060538294,
                    118.7467019075866, 30.930795622281604,
                    118.74666658808475, 30.930795427185654,
                    118.74655852241447, 30.930892942406317,
                    118.74647344111987, 30.930885345514287,
                    118.74637515394672, 30.930867228674963,
                    118.746304964143, 30.930852451844597,
                    118.74622632689008, 30.930830193095098,
                    118.74609891287098, 30.930797159286435,
                    118.74607012651764, 30.93083801442018,
                    118.74599428678505, 30.930815714711922,
                    118.74586708760968, 30.930771351746618,
                    118.74572430584591, 30.930707964831377,
                    118.74561737423095, 30.930651783398073,
                ]

            ),
            material: document.getElementById('trailer11'), // 将材质设置为video元素
            clampToGround: true,
            rotation: Cesium.Math.toRadians(180), // 整体旋转entity的角度，围绕中心点
            stRotation: Cesium.Math.toRadians(180), // 旋转entity上的材质信息
            // classificationType: Cesium.ClassificationType.BOTH
        },
    });
    rtcVideo(document.getElementById('trailer1'), url1);
    rtcVideo(document.getElementById('trailer2'), url2);
    // rtcVideo(document.getElementById('trailer3'), url3);
    rtcVideo(document.getElementById('trailer4'), url4);
    rtcVideo(document.getElementById('trailer5'), url5);
    rtcVideo(document.getElementById('trailer6'), url6);
    rtcVideo(document.getElementById('trailer7'), url7);
    rtcVideo(document.getElementById('trailer8'), url8);
    rtcVideo(document.getElementById('trailer9'), url9);
    rtcVideo(document.getElementById('trailer10'), url10);
    rtcVideo(document.getElementById('trailer11'), url11);

}
const rtcVideo = (vdo: any, url: any) => {
    let webrtc: any, webrtcSendChannel: any;

    startPlay();
    function startPlay() {
        webrtc = new RTCPeerConnection({
            sdpSemantics: "unified-plan"
        });
        webrtc.onnegotiationneeded = handleNegotiationNeeded;
        webrtc.ontrack = function (event) {
            vdo.srcObject = event.streams[0];
            vdo.play();
            //webrtc.getReceivers()[0].playoutDelayHint = 0;// 0.2s延迟
        }
        webrtc.addTransceiver('video', {
            'direction': 'sendrecv'
        });
        webrtcSendChannel = webrtc.createDataChannel('foo');

        webrtcSendChannel.onclose = () => {
            startPlay();
            console.log('[onclose] ' + url);
        }
        webrtcSendChannel.onopen = () => {
            webrtcSendChannel.send('ping');
            let webrtcSendChannelInterval = setInterval(() => {
                webrtcSendChannel.send('ping');
            }, 1000)
            console.log('[onopen] ' + url + '  延迟(ms):' + webrtcSendChannelInterval);
        }

        webrtcSendChannel.onmessage = e => console.log(e.data);

    }
    async function handleNegotiationNeeded() {
        let offer = await webrtc.createOffer();

        await webrtc.setLocalDescription(offer);
        $.post(url, {
            data: btoa(webrtc.localDescription.sdp)
        }, function (data) {
            try {
                webrtc.setRemoteDescription(new RTCSessionDescription({
                    type: 'answer',
                    sdp: atob(data)
                }))
            } catch (e) {
                console.warn(e);
            }
        });
    }

    vdo.addEventListener('loadeddata', () => {
        vdo.play();
    });

    vdo.addEventListener('error', () => {
        console.log('video1 err.')
    });

}
// 关闭全景视频
const closeVideo = () => {
    viewer.value.entities.remove(vd1)
    viewer.value.entities.remove(vd2)
    viewer.value.entities.remove(vd4)
    viewer.value.entities.remove(vd5)
    viewer.value.entities.remove(vd6)
    viewer.value.entities.remove(vd7)
    viewer.value.entities.remove(vd8)
    viewer.value.entities.remove(vd9)
    viewer.value.entities.remove(vd10)
    viewer.value.entities.remove(vd11)
}
// 细节联动feixing飞行
const toggleLinkage = (e: any) => {
    console.log(e, '号');
    if (e == 0) {
        // var Pitch = -0.520755507237188;
        // var Heading = 2.98386713252185;
        // var x = -2633939.91026626;
        // var y = 4800914.61286567;
        // var z = 3259377.4506127;
        //获取当前视角x,y,z -2634016.4697154476 4800968.953469136 3259406.7797556133 pitch -0.7912949306661874 heading 2.999788039253213
        var Pitch = -0.7912949221499987;
        var Heading = 2.9997880404834314;
        var x = -2634050.199786948;
        var y = 4801002.504504123;
        var z = 3259488.29132545;
        // 北停车场
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                roll: 0.0,
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 1) {
        var Pitch = -0.651902829923005;
        var Heading = 0.34503403519767;
        var x = -2634762.24081279;
        var y = 4801038.900043;
        var z = 3258523.65345145;
        // 滨湖大道桥
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 2) {
        var Pitch = -0.647332230344296;
        var Heading = 0.223892547726055;
        var x = -2634256.77994258;
        var y = 4801437.36644685;
        var z = 3258410.75943728;
        // 滨湖大道中
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 3) {
        var Pitch = -0.6660791939534589;
        var Heading = 0.2853002304481542;
        var x = -2633388.866464367;
        var y = 4802010.878402138;
        var z = 3258310.470235603;
        // 滨湖路
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 4) {

        var Pitch = -0.5370612169484401;
        var Heading = 3.7712174859513485;
        var x = -2635254.568472845;
        var y = 4800438.340192333;
        var z = 3259048.8183175875;
        // 滨湖路口
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 5) {
        var Pitch = -0.49868514394096;
        var Heading = 4.52096660384194;
        var x = -2634635.51795083;
        var y = 4800591.50435218;
        var z = 3259286.10553475;
        // 图书馆
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 6) {
        var Pitch = -0.4576781649728412;
        var Heading = 1.3180327317158014;
        var x = -2633170.4206070127;
        var y = 4801383.909128639;
        var z = 3259312.4786466807;
        // 西北停车场
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 7) {
        var Pitch = -0.785442770579591;
        var Heading = 0.110966023986198;
        var x = -2632713.5454618;
        var y = 4802083.38854367;
        var z = 3258660.37728007;
        // 熏华路中
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 8) {

        //获取当前视角x,y,z -2632788.491341849 4801821.982217248 3259038.7302992097 pitch -0.5835978571810898 heading 2.3015442172724763
        var Pitch = -0.5835978571810898;
        var Heading = 2.3015442172724763;
        var x = -2632788.491341849;
        var y = 4801821.982217248;
        var z = 3259038.7302992097;
        // 昭亭南路南
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    }

}
// 历史追溯 除了北停车场实体点位正确，其他都错误
const retrospection = (e: any) => {
    console.log(e);
    if (e.a == 0) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        // var Pitch = -0.520755507237188;
        // var Heading = 2.98386713252185;
        // var x = -2633939.91026626;
        // var y = 4800914.61286567;
        // var z = 3259377.4506127;
        var Pitch = -0.5294326248461259;
        var Heading = 2.942250067925441;
        var x = -2633949.893654369;
        var y = 4800932.574451372;
        var z = 3259342.6799019934;
        // 北停车场
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                roll: 0.0,
            },
            duration: 3, //定位的时间间隔
        });
        vd1 = viewer.value.entities.add({
            // 面实体
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [
                        // 118.74833003698528, 30.92769905739906,
                        // 118.75005585414905, 30.930453445943932,
                        // 118.74951858545174, 30.930388302203212,
                        // 118.75147351170376, 30.93062681392179,
                        // 118.75266384835237, 30.930138316341786,
                        // 118.75436896001614, 30.929468241695783,
                        // 118.7545699420423, 30.92804481319384,
                        118.75079162744302, 30.927937654334325,
                        118.74874971796132, 30.9283548027485,
                        118.75032646852848, 30.930505748133747,
                        118.75162717562706, 30.930516832470943,
                        118.75353837690925, 30.92972642662118,
                        118.75372851818607, 30.929629519483566,
                        118.75391862982526, 30.929535085264607,
                        118.75406817233696, 30.929172011359057,
                        118.75178909388565, 30.928080706168746,
                        118.75124934296048, 30.927947279122083,
                        118.75097343102014, 30.927930482163838
                    ]
                ),
                material: document.getElementById('trailer1'), // 将材质设置为video元素
                // name: url1,
                clampToGround: true,
                rotation: Cesium.Math.toRadians(175), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(175), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },


        });
        let videoFlvCfg1 = document.getElementById("trailer1");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()

    } else if (e.a == 1) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.651902829923005;
        var Heading = 0.34503403519767;
        var x = -2634762.24081279;
        var y = 4801038.900043;
        var z = 3258523.65345145;
        // 滨湖大道桥
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
        vd2 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [


                        118.75811119286337, 30.930288700691772,
                        118.7583258758862, 30.930164034033872,
                        118.75756514466805, 30.930606062272656,
                        118.75708874305452, 30.930175720851622,
                        118.75671076127966, 30.92986335771292,
                        118.75737238922807, 30.929702553869124,
                        118.75787894262527, 30.929566071577423,
                        118.75799210065834, 30.929660430752865,
                        118.75820732065282, 30.929835141306388,
                    ]

                ),
                material: document.getElementById('trailer2'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(-145), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(-145), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer2");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    } else if (e.a == 2) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.647332230344296;
        var Heading = 0.223892547726055;
        var x = -2634256.77994258;
        var y = 4801437.36644685;
        var z = 3258410.75943728;
        // 滨湖大道中
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                roll: 0.0,
            },
            duration: 3, //定位的时间间隔
        });
        vd4 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [

                        118.74203669285168, 30.930336145147542,
                        118.74230953644548, 30.930533120227885,
                        118.74221830604743, 30.930723665605065,
                        118.74298065837657, 30.931347377982608,
                        118.74374776875277, 30.930791570577377,
                        118.74387540058483, 30.930486834801908,
                        118.74406468798568, 30.93055928355657,
                        118.74355537084121, 30.930363655130115,
                        118.74251527693353, 30.930395630439733,
                        118.7422436631632, 30.930108701799636,
                        118.74283488054043, 30.929546506659932,
                        118.74185472989534, 30.930478428533707,
                        118.74198522747216, 30.930355207522116,
                        118.7420196641109, 30.930323575213162,
                    ]

                ),
                material: document.getElementById('trailer4'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(138), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(138), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer4");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    } else if (e.a == 3) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.660930563719111;
        var Heading = 0.406945938571216;
        var x = -2633379.82538476;
        var y = 4801956.32743725;
        var z = 3258319.61732994;
        // 滨湖路
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
        vd5 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [
                        118.74161565044673, 30.921459555759938,
                        118.74150610243329, 30.920823626580393,
                        118.74118048898954, 30.920481583079905,
                        118.74030762950608, 30.92041766382068,
                        118.74015408979768, 30.92078337255229,
                        118.74016724162139, 30.92124774860581,
                        118.74041990939837, 30.921687796898226,
                        118.74143501481745, 30.921525397651163,
                        118.74119681845264, 30.9216020889444,
                        118.74131193969397, 30.921529511479196
                    ]

                ),
                material: document.getElementById('trailer5'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(18), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(18), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer5");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    } else if (e.a == 4) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.567954343772029;
        var Heading = 2.84481226851262;
        var x = -2635165.91642613;
        var y = 4800461.03141006;
        var z = 3259023.78079441;
        // 滨湖路口
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
        vd6 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [
                        118.73350672584323, 30.92381022875457,
                        118.73335975044868, 30.923750253697907,
                        118.73290854678505, 30.923870902017338,
                        118.73288667785368, 30.92407472602999,
                        118.73332057435245, 30.92428831930626,
                        118.73325593744654, 30.92465957200228,
                        118.73344563060405, 30.924808159253658,
                        118.73410503870012, 30.92480607044783,
                        118.73421151751096, 30.924658897919986,
                        118.73419844518035, 30.924364589009723
                    ]

                ),
                material: document.getElementById('trailer6'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(1), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(1), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer6");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    } else if (e.a == 5) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.49868514394096;
        var Heading = 4.52096660384194;
        var x = -2634635.51795083;
        var y = 4800591.50435218;
        var z = 3259286.10553475;
        // 图书馆
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
        vd7 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [
                        118.75207967852666, 30.921936231891564,
                        118.75178244825207, 30.921678001032596,
                        118.7515310217848, 30.921430026621348,
                        118.75067584144097, 30.92122452897052,
                        118.75020985876257, 30.921888549761494,
                        118.75069571205898, 30.92199218790428,
                        118.75084156967104, 30.92200474643244,
                        118.75082719762285, 30.92252004405106,
                        118.75173366795485, 30.922808083717225,
                        118.75206456674081, 30.922017145064867
                    ]

                ),
                material: document.getElementById('trailer7'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(-20), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(-20), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer7");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    } else if (e.a == 6) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.493720999243499;
        var Heading = 1.59058951888898;
        var x = -2633219.90747506;
        var y = 4801331.94181593;
        var z = 3259306.50934522;
        // 西北停车场
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
        vd8 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [
                        118.73706389325874, 30.927006262544054,
                        118.73655782587221, 30.927001277071867,
                        118.73642296067312, 30.926954207364584,
                        118.73640742899882, 30.926859518056023,
                        118.73619951404922, 30.926709362665967,
                        118.73611208002117, 30.926583553194725,
                        118.73643204216806, 30.926170075563075,
                        118.73677073562942, 30.926439425924865,
                        118.73709972297489, 30.926711256899267,
                        118.73713671867938, 30.92690429931334
                    ]

                ),
                material: document.getElementById('trailer8'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(135), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(135), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer8");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    } else if (e.a == 7) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.785442770579591;
        var Heading = 0.110966023986198;
        var x = -2632713.5454618;
        var y = 4802083.38854367;
        var z = 3258660.37728007;
        // 熏华路中
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
        vd9 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [
                        118.75752804751482, 30.923154846153203,
                        118.7585483106344, 30.92338087589208,
                        118.7588257908202, 30.922388960131006,
                        118.75765020228253, 30.922132198567404,
                        118.75787523434317, 30.92218137341,
                        118.75771444447275, 30.922380325539848,
                        118.75757058046965, 30.92245863313018
                    ]

                ),
                material: document.getElementById('trailer9'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(-13), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(-13), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer9");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    } else if (e.a == 8) {
        if (!e.b) {
            ElMessage({
                message: '暂无视频',
                type: 'warning',
            })
            return
        }
        var Pitch = -0.64281551144955;
        var Heading = 1.99508538015861;
        var x = -2632819.40630856;
        var y = 4801797.46178519;
        var z = 3258986.78076264;
        // 昭亭南路南
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
        vd10 = viewer.value.entities.add({
            polygon: {
                hierarchy: Cesium.Cartesian3.fromDegreesArray(
                    [
                        118.76415967456916, 30.926284757906238,
                        118.76412173345904, 30.92669990001768,
                        118.76367200161609, 30.926992377316637,
                        118.7641724868587, 30.927447452377496,
                        118.76382862373381, 30.92713469065268,
                        118.76441983899036, 30.927257912985585,
                        118.7655589240677, 30.926409270545115,
                        118.76521248814153, 30.92605719417222,
                        118.76442917278226, 30.926093231168434,
                        118.76492938453305, 30.925736536213726
                    ]

                ),
                material: document.getElementById('trailer10'), // 将材质设置为video元素
                clampToGround: true,
                rotation: Cesium.Math.toRadians(-140), // 整体旋转entity的角度，围绕中心点
                stRotation: Cesium.Math.toRadians(-140), // 旋转entity上的材质信息
                // classificationType: Cesium.ClassificationType.BOTH
            },
        });
        let videoFlvCfg1 = document.getElementById("trailer10");//获取到video标签（id）
        // var hls = new hlsjs();
        // hls.loadSource(e.b);//视频流交给hls
        // hls.attachMedia(videoFlvCfg1);//把hls赋给了video标签
        // //播放视频
        // hls.on(hls.Events, function () {
        //     videoFlvCfg1.play();
        // })
        var flvvideo1 = flvjs.createPlayer(
            {
                type: 'flv',
                url: e.b, //你的url地址
                isLive: true,
                hasAudio: false,
            }
        );
        flvvideo1.attachMediaElement(videoFlvCfg1);
        flvvideo1.load();
        flvvideo1.play()
    }
}
// 球机协同飞行
const sbfx = (e: any) => {
    if (e == 5) {
        // var Pitch = -0.520755507237188;
        // var Heading = 2.98386713252185;
        // var x = -2633939.91026626;
        // var y = 4800914.61286567;
        // var z = 3259377.4506127;
        var Pitch = -0.5294326248461259;
        var Heading = 2.942250067925441;
        var x = -2633949.893654369;
        var y = 4800932.574451372;
        var z = 3259342.6799019934;
        // 北停车场
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                roll: 0.0,
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 4) {
        var Pitch = -0.651902829923005;
        var Heading = 0.34503403519767;
        var x = -2634762.24081279;
        var y = 4801038.900043;
        var z = 3258523.65345145;
        // 滨湖大道桥
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 7) {
        var Pitch = -0.647332230344296;
        var Heading = 0.223892547726055;
        var x = -2634256.77994258;
        var y = 4801437.36644685;
        var z = 3258410.75943728;
        // 滨湖大道中
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 2) {
        var Pitch = -0.660930563719111;
        var Heading = 0.406945938571216;
        var x = -2633379.82538476;
        var y = 4801956.32743725;
        var z = 3258319.61732994;
        // 滨湖路
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 9) {

        var Pitch = -0.567954343772029;
        var Heading = 2.84481226851262;
        var x = -2635165.91642613;
        var y = 4800461.03141006;
        var z = 3259023.78079441;
        // 滨湖路口
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 6) {
        var Pitch = -0.49868514394096;
        var Heading = 4.52096660384194;
        var x = -2634635.51795083;
        var y = 4800591.50435218;
        var z = 3259286.10553475;
        // 图书馆
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 3) {
        var Pitch = -0.493720999243499;
        var Heading = 1.59058951888898;
        var x = -2633219.90747506;
        var y = 4801331.94181593;
        var z = 3259306.50934522;
        // 西北停车场
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 1) {
        var Pitch = -0.785442770579591;
        var Heading = 0.110966023986198;
        var x = -2632713.5454618;
        var y = 4802083.38854367;
        var z = 3258660.37728007;
        // 熏华路中
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 8) {
        var Pitch = -0.64281551144955;
        var Heading = 1.99508538015861;
        var x = -2632819.40630856;
        var y = 4801797.46178519;
        var z = 3258986.78076264;
        // 昭亭南路南
        viewer.value.camera.flyTo({
            //定位到范围中心点
            destination: {
                x: x,
                y: y,
                z: z,
            },
            orientation: {
                heading: Heading, //左右方向
                pitch: Pitch, //上下方向
                //roll: 0.0
            },
            duration: 3, //定位的时间间隔
        });
    } else if (e == 'cs') {
        viewer.value.scene.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(118.7482969, 30.9254499, 2607),
            orientation: {
                heading: Cesium.Math.toRadians(358.70), // 水平偏角，默认正北 0
                pitch: Cesium.Math.toRadians(-88.81), // 俯视角，默认-90，垂直向下
                roll: 0, // 旋转角
            },
        });
    }
}
// 飞行初始页面
const ceshi1 = () => {
    viewer.value.scene.camera.flyTo({
        destination: Cesium.Cartesian3.fromDegrees(118.7482969, 30.9254499, 2607),
        orientation: {
            heading: Cesium.Math.toRadians(358.70), // 水平偏角，默认正北 0
            pitch: Cesium.Math.toRadians(-88.81), // 俯视角，默认-90，垂直向下
            roll: 0, // 旋转角
        },
    });
    //标点1
    var entity = viewer.value.entities.add({
        name: '123',
        position: Cesium.Cartesian3.fromDegrees(118.749768975769, 30.9311996161833, 45),

        //lon:115.9440582263599lat:36.41967427128944
        label: { //文字标签
            url: "2123",
            text: "北停车场",
            font: '500 30px Helvetica',// 15pt monospace
            scale: 0.5,
            // style: LabelStyle.FILL,
            //   fillColor: Color.WHITE,
            //   pixelOffset: new Cartesian2(110, -70),   //偏移量
            showBackground: true,
            // backgroundColor: new Color(26 / 255, 196 / 255, 228 / 255, 1.0)
        },
        billboard: { //图标
            image: "../../public/spred.png",
            width: 80,
            height: 80,
            // pixelOffset: new Cartesian2(100, -35),   //偏移量
            //  heightReference:HeightReference.CLAMP_TO_GROUND,
            //   VerticalOrigin:VerticalOrigin.BOTTOM
        },

    });
    var handler = new Cesium.ScreenSpaceEventHandler(viewer.value.scene.canvas);
    handler.setInputAction(function (click) {
        var pick = viewer.value.scene.pick(click.position);
        if (pick != null && pick != Object) {
            if (pick.id != undefined && pick != null && pick.id != null && pick.id != null && pick != undefined) {
                console.log(pick.id._name)

                
            } else {
            }
        } else {

        }
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    return false
}
//添加模型
var palaceTileset: any;
const addMoxing = (tag: Boolean) => {
    if (tag) {
        palaceTileset = viewer.value.scene.primitives.add(new Cesium.Cesium3DTileset({
            url: 'http://10.171.17.86:8021/ware/upload/3D0110/核心城区三维模型精修/13DCompress/merge_tile.json',//3dtiles文件位置（记得放在static或者pubilc文件夹下）
            show: true,
            // //控制切片视角显示的数量，可调整性能
            // aximumScreenSpaceError: 2,
            // maximumNumberOfLoadedTiles: 100000,
            skipLevelOfDetail: true,
            baseScreenSpaceError: 1024,
            maximumScreenSpaceError: 64, // 数值加大，能让最终成像变模糊
            skipScreenSpaceErrorFactor: 16,
            skipLevels: 1,
            immediatelyLoadDesiredLevelOfDetail: false,
            loadSiblings: true, // 如果为true则不会在已加载完概况房屋后，自动从中心开始超清化房屋
            cullWithChildrenBounds: true,
            cullRequestsWhileMoving: true,
            cullRequestsWhileMovingMultiplier: 10, // 值越小能够更快的剔除
            preloadWhenHidden: true,
            preferLeaves: true,
            maximumMemoryUsage: 128, // 内存分配变小有利于倾斜摄影数据回收，提升性能体验
            progressiveResolutionHeightFraction: 0.5, // 数值偏于0能够让初始加载变得模糊
            dynamicScreenSpaceErrorDensity: 0.5, // 数值加大，能让周边加载变快
            dynamicScreenSpaceErrorFactor: 1, // 不知道起了什么作用没，反正放着吧先
            dynamicScreenSpaceError: true, // 根据测试，有了这个后，会在真正的全屏加载完之后才清晰化房屋

        }));
    } else {
        viewer.value.scene.primitives.remove(palaceTileset)
    }
}
onMounted(() => {
    createMap()
    addMoxing(true)
    // flight(1, 'zd')
    kang.on('stopStoplszs', () => {
        closeVideo()
        // alert('关闭')
        console.log('关闭');
    })
})
defineExpose({
    flight, getView, changeValue, PanoramicVideo, closeVideo, toggleLinkage, retrospection, sbfx, ceshi1, addMoxing
})
</script>
<style scoped>
#CesiumContainer {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}
</style>